<?php include "../../coresection/connection.php";?>
<?php include "../../coresection/checkSession.php";?>
<?php include "../../coresection/order-list.php";?>
<?php include "../../coresection/get_dishes_list.php";?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php include '../../modules/head.php'; ?>
</head>

<body>
<?php include '../../modules/topbar.php'; ?>

<div class="setup_area">
    <?include '../../modules/sidebar-admin.php'?>

    <div class="header">
        <h1>菜式添加</h1>
        <?php include '../../modules/header.php'; ?>
    </div>


    <div class="content_area">

<div class="admin_left_area">
<?include '../../model/slidebar.php'?>
</div>


<div class="main product-add-box">

        <form action="../../coresection/admin-productadd.php" method="post" enctype="multipart/form-data">




            <ul class="admin_set_table">

<li>

                    <label>时段: </label>
                    <select  onchange=mbar(this)>
                        <?
                        if($_REQUEST['at']=='1'){$nowterm="早餐";}
                        elseif($_REQUEST['at']=='2'){$nowterm="午餐";}
                        elseif($_REQUEST['at']=='3'){$nowterm="晚餐";}
                        else{$nowterm="";}
                        ?>
                        <option value="">当前选择:<?echo $nowterm?></option>
                        <option value="admin_productadd.php?at=1">早餐</option>
                        <option value="admin_productadd.php?at=2">午餐</option>
                        <option value="admin_productadd.php?at=3">晚餐</option>
                    </select>
    <em class="explain" style="color: red">请先选择时段</em>

    <input name="product_at" type="hidden" value="<?echo  $_REQUEST['at'] ?>"/>

</li>




                <li><label>菜式名：</label><input type="text" name="product_name" id="product_name" value="选择时段后，点击选择菜式" style="border:none;background-color: transparent"/></li>
                <li><label>单价：</label><input type="text" name="product_price" id="product_price" value="" style="border:none;background-color: transparent"/></li>
                <li><label>日期：</label>

                    <select name="product_month" class="product_week">

                        <option value="<? echo number_format(date(m)) ?>"> <? echo number_format(date(m)) ?>月</option>

                        <? for($i=1;$i<=12;$i++){?>
                            <option value="<? echo $i ?>"> <? echo $i ?>月</option>
                        <? } ?>

                    </select>


                    <select name="product_week">
                    <? for($i=1;$i<=31;$i++){?>
                    
                    <option value="<? echo $i ?>"><? echo $i ?>号</option>
                    
					<? } ?>


                    </select>
                    <em class="explain" style="color: red">请先选择具体日期</em>
                </li>
            </ul>


            <div style="margin-top: 20p; margin-left: 90px;">
                <input type="submit" class="layui-btn" value="确定""/>
            </div>


            <style>
                .dishes-list{ list-style: none; overflow: hidden; margin-top: 25px; padding-top: 25px; border-top:dashed 1px #232323}
                .dishes-list li{ text-align:left;float: left;min-width: 320px; margin-bottom: 10px;}
            </style>

<ul class="dishes-list">
<? if($_REQUEST['at'])
{$dishes=get_dishes_list($_REQUEST['at']);}
?>
<?for($i=0;$i<count($dishes['name']);$i++)
{
?>

<li>
    <input type="radio"name='dishes-name-option' value="<? echo $dishes['nid'][$i]?>" onclick="setvalue('<? echo $dishes['name'][$i]?>','<? echo $dishes['price'][$i]?>')"/>
    <? echo $dishes['name'][$i]?> /
    <span style="font-size: 12px;"  >
        <? echo $dishes['price'][$i]?>
    </span>
</li>

<?
}
?>


    <script type="text/javascript">
        function setvalue(name,price){
            document.getElementById("product_name").value=name;
            document.getElementById("product_price").value=price;
        }
    </script>



</ul>



        </form>



</div>
</div>



        <style>
            .main label{ text-align: right; margin-right: 10px;}
            .admin_set_table  input{width: 300px!important;}
            .admin_set_table  select{width: 150px!important;}
        </style>


        <script type="text/JavaScript">

            function mbar(sobj) {
                var docurl =sobj.options[sobj.selectedIndex].value;
                if (docurl != "") {
                    open(docurl,'_self');
                    sobj.selectedIndex=0;
                    sobj.blur();
                }
            }

        </script>


    <?php include '../../modules/footer.php'; ?>
</body>
</html>
